package com.acme.team02.chat.server.domain;

import com.acme.team02.chat.server.connection.Connect;

public class User {
	private Connect userConnect;
	private String userName; 
	
	private String room;
	
	public User(Connect connect, String name) {
		userConnect = connect;
		userName = name;
		room = "Main chat";
	}

	/**
	 * Room where user is
	 * @return
	 */
	public String getRoom() {
		return room;
	}

	/**
	 * Move user to another room
	 * @param room
	 */
	public void setRoom(String room) {
		this.room = room;
	}


	/**
	 * user name
	 * @return
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * change username
	 * @param userName
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

	/**
	 * User connect link
	 * @return
	 */
	public Connect getUserConnect() {
		return userConnect;
	}

	/**
	 * Send message to user
	 * @param message
	 */
	public void sendMessage(Message message){
		userConnect.sendMessage(message.toString());
	}
	
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return userName;
	}
}
